package com.googlecode.auctionx;

import java.util.Collection;

import com.googlecode.auctionx.beans.Auction;
import com.googlecode.auctionx.mercadolivre.MercadoLivreSearch;

public class AuctionXService {
	private static String MERCADOLIVRE = "ML";
	
	public static Search createSearch(String service) throws AuctionXException {
		if ( MERCADOLIVRE.equals(service) ) {
			return new MercadoLivreSearch();
		}
		throw new AuctionXException("Service " + service + " doesn't exist. Instead, use ML");
	}

	public static void main(String[] args) {
		Search search = AuctionXService.createSearch("ML");

		Collection<Auction> auctions = search
					.addRestriction(Restriction.onlyCertifiedSellers())
					.addRestriction(Restriction.buyNow())
					.addRestriction(Restriction.onlyNewProducts())
					.addRestriction(Restriction.quantity(2L))
					.search("iphone");
		
		System.out.println(auctions);
	}
}